package com.wowangz.cms.common.easyui.tree;

import java.util.ArrayList;

import net.sf.json.JSONArray;

/**
 * 
 * @author leiyang3
 *
 */
public class TreeConstant {
	
    public static class TreeState
    {
    	public static final String OPEN = "open";
    	public static final String CLOSED = "closed";
    }

   public static void main(String[] arg0){
    	
	   TreeInfo rootInfo = new TreeInfo();
	   rootInfo.setId(0);
	   rootInfo.setText("全选");
	   rootInfo.setState(TreeConstant.TreeState.OPEN);
	   
	   ArrayList list = new ArrayList();
	   TreeInfo firstInfo;
	   for(int i=1; i<=10; i++){
		   firstInfo = new TreeInfo();
		   firstInfo.setId(i);
		   firstInfo.setText("一级节点" + i);
		   firstInfo.setState(TreeConstant.TreeState.CLOSED);
		   list.add(firstInfo);
	   }
	   rootInfo.setChildren(list);
	   
		String json = "";
		json = JSONArray.fromObject(rootInfo).toString();
	   
	   System.out.println(json);
	   
	   String menuCode = "M0-100-300";
	   System.out.println(menuCode.lastIndexOf("-"));
	   System.out.println(menuCode.substring(0, menuCode.lastIndexOf("-")));
    }
}
